/**
 * @Title: ServiceImpl.java
 * @Package service.impl
 * @author zhanglinlu
 * @date 2019年4月23日 下午2:37:06
 */
package com.zll.ccp.service.impl;

import com.zll.ccp.mapper.IUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zll.ccp.model.User;
import com.zll.ccp.service.ILoginService;

/**
 * @ClassName: ServiceImpl
 * @Description: TODO
 * @author zhanglinlu
 * @date 2019年4月23日 下午2:37:06
 * 
 */
@Service
@Transactional
public class LoginServiceImpl implements ILoginService {
    @Autowired
    private IUserMapper IUserMapper;

    /* (non-Javadoc)
     * @param userName
     * @return
     * @see service.IService#getUserByUserName(java.lang.String)
     */
    public User getUserByUserName(String userName) {
        return IUserMapper.getUserByUserName(userName);
    }

    /* (non-Javadoc)
     * @param user
     * @see com.zll.ccp.service.ILoginService#addUser(com.zll.ccp.model.User)
     */
    @Override
    public void addUser(User user) {
        IUserMapper.addUser(user);
    }

    /* (non-Javadoc)
     * @param userName
     * @return
     * @see com.zll.ccp.service.ILoginService#existByUserName(com.zll.ccp.model.User)
     */
    @Override
    public boolean existByUserName(String userName) {
        User user = IUserMapper.getUserByUserName(userName);
        // 不存在返回false 存在返回true
        return user != null;
    }

    /* (non-Javadoc)
     * @param user
     * @see com.zll.ccp.service.ILoginService#updateUserById(com.zll.ccp.model.User)
     */
    @Override
    public void updateUserById(User user) {
        IUserMapper.updateUserById(user);
    }

}
